<?php
namespace app\api\controller;
use app\common\BaseController;
use app\api\model\SupplierProduct as SupplierProductModel;
class SupplierProduct extends BaseController{    
    public function __construct(SupplierProductModel $model){
        parent::__construct();
        $this->model = $model;
    }
    //添加
    public function create(){        
        $params = $this->request->get();         
        $data = $this->model->allowField(true)->data($params)->save();
        return $data;
    }
    //编辑
    public function update(){        
        $params = $this->request->get();
        $data = $this->model->allowField(true)->save($params,['id',$params['id']]);
        return $data;
    }
    //删除
    public function delete(){
        $params = $this->request->get();      
        $data = $this->model->allowField(true)->where('id',$params['id'])->delete();
        return $data;
    }

}